package com.cg.asm.body.config.loading;

import com.cg.asm.body.config.loading.cache.menu.IMenuCache;
import com.cg.asm.body.config.loading.cache.org.IOrgCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class StartupLoading implements CommandLineRunner {

    private IMenuCache menuCache;
    private IOrgCache orgCache;

    @Autowired
    public StartupLoading(IMenuCache menuCache, IOrgCache orgCache) {
        this.menuCache = menuCache;
        this.orgCache = orgCache;
    }

    @Override
    public void run(String... strings) {
        menuCache.initMenuPointsAndRole();
        orgCache.initOrgTreeData();
    }
}
